<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            position: absolute;
            left: 0;
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>
</body>

<script>
    let div = document.querySelector('div');

    function animate(element, time) {
        let timer = setInterval(function() {
            console.log(element.offsetLeft);
            if (element.offsetLeft > 200) {
                clearInterval(timer);
            };
            element.style.left = element.offsetLeft + 1 + 'px';
        }, time);
    };
    animate(div, 10);
</script>

</html>